#include "stdafx.h"
#include "Sprite.h"


CSprite::CSprite(void)
{
	//initialise variables
	m_fX = 0.0f;
	m_fY = 0.0f;
	m_fW = 1.0f;
	m_fH = 1.0f;
	m_iTextureID = 0;
}

CSprite::CSprite(float x_, float y_, float w_, float h_, int texture_)
{
	//initialise variables
	m_fX = x_;
	m_fY = y_;
	m_fW = w_;
	m_fH = h_;
	m_iTextureID = texture_;
}

CSprite::~CSprite(void)
{
}


void
CSprite::render()
{

	glBindTexture(GL_TEXTURE_2D, m_iTextureID); //use the one and only texture
	glEnable(GL_TEXTURE_2D);
	glEnable(GL_BLEND);// Turn Blending On
	glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);

	glLoadIdentity();
	glTranslatef(m_fX,m_fY,-5.0f);		// move back 5 units
	glScalef(m_fW, m_fH, 1.0);
	glColor3f(1.0f,1.0f,1.0f);		// set color to red

	// Display a quad 
	glBegin(GL_QUADS);
		glTexCoord2f(0.0f, 1.0f);
		glVertex3f(-0.5, 0.5, 0);

		glTexCoord2f(0.0f, 0.0f);
		glVertex3f(-0.5, -0.5, 0);

		glTexCoord2f(1.0f, 0.0f);
		glVertex3f(0.5, -0.5, 0);

		glTexCoord2f(1.0f, 1.0f);
		glVertex3f(0.5, 0.5, 0);
	glEnd();
}


void
CSprite::update(float dt_)
{


}